<template>

  <div>测试权限筛选逻辑</div>
</template>

<script>
// 1. 拿到所有的动态路由数组
import { asyncRoutes } from '@/router'
export default {

  created() {
    // 造一个员工 roles.menus 权限数组的假数据
    const menus = ['approvals', 'departments']
    // 过滤动态路由, 只留下能进的(名称存在于 menus)
    const routes = asyncRoutes.filter(el => menus.includes(el.name))
    console.log('筛选后的路由')
    console.log(routes)
  }
}
</script>
